<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>编辑商家</title>
<link href="${rc.getContextPath()}/resources/css/common.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="${rc.getContextPath()}/resources/js/jquery.js"></script>
<script type="text/javascript" src="${rc.getContextPath()}/resources/js/common.js"></script>
<script type="text/javascript" src="${rc.getContextPath()}/resources/js/jquery.validate.js"></script>
<script type="text/javascript" src="${rc.getContextPath()}/resources/js/messages_cn.js"></script>
<script type="text/javascript" src="${rc.getContextPath()}/resources/js/input.js"></script>
<script type="text/javascript" src="${rc.getContextPath()}/js/ajaxupload.js"></script>
<script type="text/javascript" src="${rc.getContextPath()}/js/lhgdialog/lhgdialog.min.js?self=true"></script>
<script type="text/javascript">
var storeId='${storeId!}';
var base='${base!}';
function goBackToList() {
	location.href = base+"/store/admin/list.html";
};
function saveCompany() {
	var form1 = $("#tableForm");
	form1.submit();
}
function myAlert(txt) {
	window.parent.$.dialog({
		lock : true,
		content : txt,
		cancelVal : '确定',
		autoSize : true,
		cancel : function() { //请求成功后处理函数。 
		}
	});
}
$(document).ready(function() {
	var $inputForm = $("#tableForm");
	$inputForm.validate({
		errorClass : "fieldError",
		rules : {
			companyName : {required:true,maxlength:95},
			address : {required:true,maxlength:95},
			storeOrder :{required:true,number:true,min:1,max:999}
		}
	});
}); 
function saveCompany() {
	var rank = $("#txtRank").val() - 0;
	if (isNaN(rank)) {
		alert("排序字段只能输入数字");
		$("#txtRank").focus();
	} else {
		$('#tableForm').submit()
	}
};
function getTags(){
	var url = "url:${base!}/store/admin/getTags.html?storeId="+storeId;
	window.$.dialog({
		lock: true,
		content: url,
		title:'选择标签',
		cancelVal: '关闭',
		width:'300px',
		height:'360px',
	    cancel: function(){
	    },
		button: [
		         {name: '保存',callback:function(){
		        	 this.content.save();
		        	 return false;
		         }}
	         ]
	});	
}
</script>
</head>

<body>
	<input type="hidden" id="msg" name="msg" value="${msg!}" />
	<div class="path">
		<b>编辑商家</b>
	</div>
	<form action="${base!}/store/admin/save.html" method="post" id="tableForm" name="tableForm" enctype="multipart/form-data">
		<input type="hidden" name="storeId" value="${storeId!}" />
		<input type="hidden" name="companyId" value="${company.companyId!}" />
		<table class="input tabContent">
			<tbody>
				<tr>
					<th><span class="requiredField">*</span>商家名称:</th>
					<td>
						<input type="text" name="companyName" value="${company.companyName!}" size="45"/>
					</td>
					<th><span class="requiredField">*</span>商家地址:</th>
					<td>
						<input type="text" id="address" name="address" value="${company.address!}" size="45"/>
					</td>
				</tr>				
				<tr>
					<th>联系电话:</th>
					<td>
						<input type="text" name="telephone" value="${company.telephone!}"size="45" />
					</td>
					<th>特色说明:</th>
					<td><input class="w150" type="text" name="characteristics" value="${store.characteristics!}"size="45" /></td>
				</tr>
				<tr>
					<th>产品评价:</th>
					<td>
						<input type="text" name="productEvaluate" value="${store.productEvaluate!}"size="45" />
					</td>
					<th>环境评价:</th>
					<td><input class="w150" type="text" name="envEvaluate" value="${store.envEvaluate!}"size="45" /></td>
				</tr>
				<tr>
					<th>服务评价:</th>
					<td>
						<input type="text" name="servEvaluate" value="${store.servEvaluate!}"size="45" />
					</td>
					<th>人均消费:</th>
					<td><input class="w150" type="text" name="per" value="${store.per!}" size="45"/></td>
				</tr>								
				<tr>
					<th>标签:</th>
					<td>
						<input type="hidden" id="tagIds" name="tagIds" value="${tagIds!}"size="45"/>
						<input type="text" id="tagName" name="tagName" value="${tagName!}" readonly="readonly" onclick="getTags()" size="45"/></td>
					<th>图标:</th>
					<td>
						<select name="iconId">
							<#if icons?? && icons?size gt 0>
								<#list icons as ic>
									<option value="${(ic.iconId)!}" <#if store.iconId?? && store.iconId==ic.iconId> selected="selected"</#if>>${(ic.title)!}</option>
								</#list>
							</#if>
						</select>
					</td>
				</tr>
				<tr>
					<th>会员专享折数:</th>
					<td colspan="1">
						<input type="text" name="memberCount" value="${store.memberCount!}"/>
					</td>
					<th><span class="requiredField">*</span>排序:</th>
					<td colspan="3">
						<input type="text" name="storeOrder" value="${store.storeOrder!}"/>
					</td>					
					<!-- 
					<th>会员专享说明:</th>
					<td>
						<input type="text" name="memberDesc" value="${store.memberDesc!}" id="memberDesc"/>
					</td>
					-->
				</tr>
				<tr>
					<th>优惠信息:</th>
					<td colspan="3">
						<textarea rows="8" cols="85" name="discountInfo">${store.discountInfo!}</textarea>
					</td>					
				</tr>										
			</tbody>
		</table>

		<table class="input">
			<colgroup>
				<col width="15%" />
				<col width="35%" />
				<col width="15%" />
				<col width="35%" />
			</colgroup>
			<tr>
				<td></td>
				<td colspan="3">
					<input type="submit" class="button" value="保存" /> 
					<input type="button" class="button" value="返回" onclick="goBackToList()" />
				</td>
			</tr>
		</table>
	</form>
</body>
</html>